package Practice16;

public class Demo {
    private static String[] names = {"bill", "hill", "jill"};

    public static void main(String[] args) {
        try {
            checkUserName("bill");
            System.out.println("注册成功");
        } catch (RegisterException e) {
            e.printStackTrace();
        }
    }

    public static boolean checkUserName(String str) throws RegisterException {
        for (String name : names
                ) {
            if (name.equals(str)) {
                throw new RegisterException(str+"已经被注册了");
            }
        }

        return true;
    }
}
